/**
 * 
 */
package net.ib.mtalk.receiver;

import net.ib.mtalk.global.GlobalPreferences;
import net.ib.mtalk.network.FileClient;
import net.ib.mtalk.service.SelecterService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 시스템의 특정 이벤트들을 받아서 서비스를 부활시켜주는 역할을 한다.
 * @author Arngard
 */
public class ServiceRestartSignReceiver extends BroadcastReceiver {
	
	@Override
	public void onReceive(Context context, Intent intent) {
		//MTalkLogWriter.v("ServiceRestartSignReceiver.onReceive() - start");

		//TcpClient.expiredCollector();	// 이 호출의 안정성은 NetFlowControl.actionTraffic()로 위임되었다.
		FileClient.expiredCollector();
		if (GlobalPreferences.getRegistrationId() == null) {
			SelecterService.actionStart(context);//LocalService.actionStart(context);
		} else {
			//MTalkLogWriter.d("ServiceRestartSignReceiver.onReceive(): There's C2DM RegistrationId.");
		}

		//MTalkLogWriter.v("ServiceRestartSignReceiver.onReceive() - end");
	}
}
